#ifndef ALFS_GUI_USERCOMMAND_H
#define ALFS_GUI_USERCOMMAND_H

// File [alfs/gui/UserCommand.h].
//
// UserCommand
//
// A UserCommand represents some user action (e.g. button or menu action) abstractly,
// without a binding to any internal program action.  It provides the information needed
// to present the action to the user, including an id that can be used for national
// language resource retrieval.  It provides a set of standard id's for common actions.
//
// (c) copyright Alf P. Steinbach 2008.
// Use, modification and distribution are subject to the "New BSD License"
// as listed at <url: http://www.opensource.org/licenses/bsd-license.php>.

#include    <alfs/pointers/CheckingPtr.hpp>     // alfs::CheckingPtr
#include    <cassert>                           // assert
#include    <climits>                           // INT_MAX
#include    <map>                               // std::map
#include    <string>                            // std::wstring

namespace alfs{

#   define ThisClass    UserCommand

    class ThisClass
    {
    public:
        enum Id { null = 0, maxValue = INT_MAX };
        // The implementation (e.g. wxWidgets) may not support larger id range than int.

        static Id const    idFileExit;
        static Id const    idHelpAbout;

    private:
        Id              myId;
        std::wstring    myDefaultText;

        static Id newId();

        void assertInvariant()
        {
            assert( !(myId != null && myDefaultText.length() == 0) );
        }

    protected:
        virtual ~ThisClass();

    public:
        typedef AutoNewPtr<ThisClass>   Ptr;

        ThisClass();
        ThisClass( Id id, std::wstring const& defaultText );
        ThisClass( std::wstring const& defaultText );

        Id id() const;
        std::wstring text() const;

        bool operator<( UserCommand const& other ) const;
        bool operator==( UserCommand const& other ) const;
    };
#   undef   ThisClass

}  // alfs
#endif
